package ch.Day08oop;

public class LambdaDemo {
    public static void main(String[] args) {
        // 使用匿名函数
        Animal cat = new Animal() {
            @Override
            public void eat() {
                System.out.println("猫吃鱼");
            }
        };
        cat.eat();
        Animal lambdacat = () -> {
            System.out.println("使用Lambda表达式简化匿名函数");
        };
        lambdacat.eat();
    }
}

// 函数式接口
@FunctionalInterface
interface Animal {
    void eat();
}

